﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace dogetrader
{
    public partial class SettingsDialog : Form
    {
        public SettingsDialog()
        {
            InitializeComponent();

            updatePeriodSecondsNumericUpDown.Value = (decimal)Properties.Settings.Default.updatePeriodSeconds;
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            if ((publicAPIKeyTextBox.Text != "") && (secretAPIKeyTextBox.Text != ""))
            {
                Properties.Settings.Default.publicAPIKey = publicAPIKeyTextBox.Text;
                Properties.Settings.Default.secretAPIKey = secretAPIKeyTextBox.Text;
            }
            Properties.Settings.Default.updatePeriodSeconds = (int)updatePeriodSecondsNumericUpDown.Value;
            Properties.Settings.Default.Save();

            publicAPIKeyTextBox.Text = "";
            secretAPIKeyTextBox.Text = "";

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
